package cn.crm.service.impl;

import cn.crm.dao.OrdersDao;
import cn.crm.pojo.Orders;
import cn.crm.service.OrdersService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor = Exception.class)//事务回滚
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements OrdersService {
    @Autowired
    private OrdersDao ordersDao;
    @Override
    public Page<Orders> getOrdersPageByCustNo(Page page,String custNo) {
        LambdaQueryWrapper<Orders> lqw = new LambdaQueryWrapper<>();
        lqw.eq(Orders::getOdrCustomer,custNo);
        lqw.orderByDesc(Orders::getOdrId);
        return ordersDao.selectPage(page,lqw);
    }
}
